﻿@using SimpleScrum.Areas.Scrum.Models
@using SimpleScrum.Utils
@model SimpleScrum.Areas.Scrum.Models.UserStoryTasksModel
@{
    ViewBag.Title = "User Story Information";
    var objUsers = new UsersModel();
}
<div class="breadcrumbs" id="breadcrumbs">
    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="@Url.Action("Index","DashBoard")">Home</a>
            <span class="divider">
                <i class="icon-angle-right arrow-icon"></i>
            </span>
        </li>
        <li>
            <a href="@Url.Action("Details", "Project", new {id=@Client.Instance.CurrentProjectId})">Project</a>
            <span class="divider">
                <i class="icon-angle-right arrow-icon"></i>
            </span>
        </li>
        <li>
            <a href="@Url.Action("Index", "UserStory", new {projectId=@Client.Instance.CurrentProjectId})">User Story</a>
            <span class="divider">
                <i class="icon-angle-right arrow-icon"></i>
            </span>
        </li>
        <li class="active">@Model.UserStoryInfo.Title</li>
    </ul>
    <div class="nav-search pull-right">
        <a class="btn btn-small btn-yellow" href="@Url.Action("Edit","UserStory",new {id = Model.UserStoryInfo.Id})">
            <i class="icon-edit-sign"></i> Edit
        </a>
        <a class="btn btn-small btn-grey" href="@Url.Action("Index", "UserStory", new {projectId=@Client.Instance.CurrentProjectId})">
            <i class="icon-list-alt"></i> All UserStories
        </a>
        <a class="btn btn-small btn-success" href="@Url.Action("New","UserStory")">
            <i class="icon-plus-sign-alt"></i> New User Story
        </a>
        <a class="btn btn-small btn-success" href="@Url.Action("New","UserStoryTask", new {userStoryId=@Model.UserStoryInfo.Id})">
            <i class="icon-plus-sign-alt"></i> New Task
        </a>
    </div>
</div>
<div class="page-content">
    <div class="page-header position-relative">
        <h1>@ViewBag.Title<small><i class="icon-double-angle-right"></i>@ViewBag.Message</small></h1>
    </div>
    <div class="row-fluid">
        <div class="widget-container-span">
            <div class="widget-box">
                <div class="widget-header">
                    <h5>@Model.UserStoryInfo.Title</h5><h5 class="pull-right">Created Date: @Model.UserStoryInfo.CreatedDate.ToLongDateString()</h5>
                    <div class="widget-toolbar">
                        <a href="#" data-action="reload"><i class="icon-refresh"></i></a>
                        <a href="#" data-action="collapse"><i class="icon-chevron-up"></i></a>
                    </div>
                    <div class="widget-body">
                        <div class="widget-main">
                            <p class="alert alert-info">@Model.UserStoryInfo.Details </p>
                            <p class="alert alert-success">
                                @*@Html.ActionLink("Backlog", "Index", "BackLog", new { UserStoryId=Model.UserStory.Id }, new {@class="btn btn-info"})*@
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        @foreach (var item in Model.UserStoryTaskList)
        {
            var user = objUsers.GetUsersById(item.AssignTo.Id);
            <div class="span4 widget-container-span">
                <div class="widget-box light-border">
                    <div class="widget-header header-color-dark">
                        <h5 class="smaller">Task: @item.Name</h5>

                        <div class="widget-toolbar">
                            <span class="badge badge-important">@item.AssignDate.ToLongDateString()</span>
                        </div>
                    </div>

                    <div class="widget-body">
                        <div class="widget-main padding-6">
                            <div class="alert alert-info">Work Hour: <strong>@item.WorkHour</strong></div>
                            <div class="alert alert-success pull-right">Assign To: <strong>@user.FirstName @user.LastName</strong></div>
                        </div>
                    </div>
                </div>
            </div>
        }
    </div>
</div>

@section Scripts{
    <script src="~/Content/Customize/js/jquery-ui-1.10.3.custom.min.js"></script>
	<script src="~/Content/Customize/js/jquery.ui.touch-punch.min.js"></script>
    <script src="~/Content/Customize/js/jquery.slimscroll.min.js"></script>
}

@section ScriptsText{
    <script type="text/javascript">
        $(function () {

            $('#simple-colorpicker-1').ace_colorpicker({ pull_right: true }).on('change', function () {
                var color_class = $(this).find('option:selected').data('class');
                var new_class = 'widget-header';
                if (color_class != 'default') new_class += ' header-color-' + color_class;
                $(this).closest('.widget-header').attr('class', new_class);
            });

            // scrollables
            $('.slim-scroll').each(function () {
                var $this = $(this);
                $this.slimScroll({
                    height: $this.data('height') || 100,
                    railVisible: true
                });
            });

            // Portlets (boxes)
            $('.widget-container-span').sortable({
                connectWith: '.widget-container-span',
                items: '> .widget-box',
                opacity: 0.8,
                revert: true,
                forceHelperSize: true,
                placeholder: 'widget-placeholder',
                forcePlaceholderSize: true,
                tolerance: 'pointer'
            });

        });
    </script>
}